#!/usr/bin/env python

from tables import *

fileh = openFile('ibov.h5', mode='r')

table = fileh.root.stocks.PETR4

close = [(row['date'], row['close']) for row in table.iterrows() if row['date'] >= '2002-01-01' and row['date'] < '2009-01-01']

for p in sorted(close):
    print p[0], p[1]